<template>
  <div class="achievement" v-cloak>
    <div class="bg_color"></div>
    <div style="height: 4px;position: absolute;z-index: 2222; width: 100%; top: 46px;background: #f0f0f0"></div>
    <div style="height: 50px;"></div>
    <div class="about-us" v-show="show">
      <div class="feekback-form">
        <ul>
          <li class="textarea">
            <textarea placeholder="请填写您的备注需求……" class="c4c4c4" v-model="content"></textarea>
          </li>
        </ul>
      </div>
      <div class="content-box">
        <div class="login-btn">
          <button @click="demand">保存</button>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
  export default {
    name: 'Demand',
    data () {
      return {
        show: true,
        content: ''
      }
    },
    methods: {
      setmode: function (name, content) {
        let mode = this.$chaos.config('mode')
        if (mode === 'website') {
          sessionStorage[name] = JSON.stringify(content)
        } else {
          localStorage[name] = JSON.stringify(content)
        }
      },
      verify: function () {
        this.$chaos.setTitle('备注需求')
        this.$store.commit('headerShow', true)
        this.$store.commit('title', '备注需求')
        this.$store.commit('footerShow', false)
        this.setmode('need-refresh', true)
      },
      demand: function () {
        var thisObj = this
        if (thisObj.content === '') {
          thisObj.$vux.toast.show({
            text: '请输入您的备注需求',
            type: 'text',
            width: '180px',
            position: 'bottom'
          })
          return false
        }
        thisObj.setmode('service', 'two')
        thisObj.setmode('demand', thisObj.content)
        setTimeout(function () {
          window.history.back(-1)
        }, 300)
      }
    },
    created: function () {
      this.verify()
    },
    mounted: function () {
      window.scrollTo(0, 2000)
    },
    watch: {
      '$route': 'verify'
    }
  }
</script>
<style scoped>
  [v-cloak] {
    display: block;
  }
  .feekback-form .textarea {
    margin: 15px 0px;
    background-color: white;
    width: calc(100% - 30px);
  }
  .textarea {
    height: 120px;
    width: calc(100% - 32px);
    background-color: #f9f9f9;
    padding: 15px 15px;
    margin-top: 20px;
  }
  ol, ul {
    list-style: none;
  }
  .feekback-form {
    padding: 0px 15px;
  }
  .feekback-form .textarea textarea {
    width: calc(100% - 20px);
    color: #000;
    resize: none;
    font-size: 12px;
  }
  input, button, textarea {
    border: 0;
    margin: 0;
    padding: 0;
    outline: none;
    resize: none;
  }
  .content-box {
    padding: 0px 15px;
  }
  .login-btn {
    margin-top: 40px;
  }
  .login-btn button {
    width: 100%;
    background-color: #ffa128;
    height: 40px;
    line-height: 40px;
    color: white;
    text-align: center;
    border-radius: 6px;
  }
</style>
